package com.csx.governance.traffic.core.context;

/**
 * <p>内部上下文对象</p>
 * <p>保存由 程序内部定时任务 发起的 出栈请求的请求对象</p>
 * @author cuisongxu
 * @date 2023/3/18 19:35
 */
public class TrafficInternalContexts {

    private static final ThreadLocal<TrafficMessage> MESSAGE_THREAD_LOCAL = new ThreadLocal<>();

    public static void set(TrafficMessage context) {
        MESSAGE_THREAD_LOCAL.set(context);
    }

    public static TrafficMessage get() {
        return MESSAGE_THREAD_LOCAL.get();
    }

    public static void clear() {
        MESSAGE_THREAD_LOCAL.remove();
    }
}
